﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace ZYStudios.Filter
{
    public class UserAuthFilter : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var Session = filterContext.HttpContext.Session;
            if (Session["IsAdminLogin"] != null && Session["IsAdminLogin"].ToString().ToUpper() == "TRUE")
            {
                filterContext.Controller.ViewData["IsAdminLogin"] = true;
            }
            else
            {
                filterContext.Controller.ViewData["IsAdminLogin"] = false;
            }
            if (Session["User_Info"] != null)
            {
                filterContext.Controller.ViewData["IsUserLogin"] = true;
            }
            else
            {
                filterContext.Controller.ViewData["IsUserLogin"] = false;
            }

        }
    }
}